#define _CRT_SECURE_NO_WARNINGS 1
int sum(char n)
{
    switch (n)
    {
    case 'I':
        return 1;
    case 'V':
        return 5;
    case 'X':
        return 10;
    case 'L':
        return 50;
    case 'C':
        return 100;
    case 'D':
        return 500;
    case 'M':
        return 1000;
    }
    return 0;
}
int main() {
    char s[20] = "DCXXI";
    int k = 0;

    for (int i = 0; s[i] != '\0'; i++)
    {
        if (s[i] == 'I' && s[i + 1] == 'V')
        {
            k += 4;
            i++;
            continue;
        }
        if (s[i] == 'I' && s[i + 1] == 'X')
        {
            k += 9;
            i++;
            continue;
        }
        if (s[i] == 'X' && s[i + 1] == 'L')
        {
            k += 40;
            i++;
            continue;
        }
        if (s[i] == 'X' && s[i + 1] == 'C')
        {
            k += 90;
            i++;
            continue;
        }
        if (s[i] == 'C' && s[i + 1] == 'D')
        {
            k += 400;
            i++;
            continue;
        }
        if (s[i] == 'C' && s[i + 1] == 'M')
        {
            k += 900;
            i++;
            continue;
        }
        k += sum(s[i]);
    }

    return 0;
}

char* longestCommonPrefix(char** strs, int strsSize) {
    for (int i = 0; i < strsSize - 1; i++)
    {
        for (int j = 0; j < strlen(strs[i + 1]); j++)
        {
            if (strs[i][j] != strs[i + 1][j])
            {
                strs[i + 1][j] = '\0';
                continue;
            }
        }
    }
    return strs[strsSize - 1];
}